package com.nbsaas.boot.cms.rest.resource;

import com.nbsaas.boot.cms.api.apis.ContentBlockApi;
import com.nbsaas.boot.cms.data.entity.ContentBlock;
import com.nbsaas.boot.cms.api.domain.request.ContentBlockRequest;
import com.nbsaas.boot.cms.api.domain.response.ContentBlockResponse;
import com.nbsaas.boot.cms.api.domain.simple.ContentBlockSimple;
import com.nbsaas.boot.cms.rest.convert.ContentBlockSimpleConvert;
import com.nbsaas.boot.cms.rest.convert.ContentBlockEntityConvert;
import com.nbsaas.boot.cms.rest.convert.ContentBlockResponseConvert;
import com.nbsaas.boot.cms.data.repository.ContentBlockRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   内容块-业务接口实现
*/
@Transactional
@Service
public class ContentBlockResource extends BaseResource<ContentBlock,ContentBlockResponse, ContentBlockSimple, ContentBlockRequest>  implements ContentBlockApi {

    @Resource
    private ContentBlockRepository contentBlockRepository;

    @Override
    public JpaRepositoryImplementation<ContentBlock, Serializable> getJpaRepository() {
        return contentBlockRepository;
    }

    @Override
    public Function<ContentBlock, ContentBlockSimple> getConvertSimple() {
        return new ContentBlockSimpleConvert();
    }

    @Override
    public Function<ContentBlockRequest, ContentBlock> getConvertForm() {
        return new ContentBlockEntityConvert();
    }

    @Override
    public Function<ContentBlock, ContentBlockResponse> getConvertResponse() {
        return new ContentBlockResponseConvert();
    }




}


